package com.bjsxt.collection;

import java.util.Set;
import java.util.TreeSet;

public class treeSetTest {
    public static void main(String[] args) {
        Set<String> set = new TreeSet<>();
        set.add("s");
        set.add("fgg");
        set.add("ta");
        set.add("f");
        System.out.println(set);

        Set<Users> set1 = new TreeSet<>();
        Users u =new Users("sad",12);
        Users u1 =new Users("sad",17);
        set1.add(u);
        set1.add(u1);
        System.out.println(set1); //set1按Users的compareTo的规则排序
    }
}
